Any running computer program (e.g., software system), at any point in time, can be represented as a directed graph of Abstract Data Types (ADT) and the connections between them. As is known, an Abstract Data Type is a complex data type that includes both data and references to other instances of abstract data types. During the runtime of a computer program, it is often helpful to be able to examine the state of the various ADTs and the relationships between them for various purposes, such as monitoring, debugging, and performance analysis. Exposing this information to an entity outside of the system itself (perhaps through a network or Graphical User Interface (GUI)) or within the system itself as a feedback mechanism, may be useful.
For production software systems, there are two conventional approaches to monitoring executing software. Full “debugging versions” of software can be run at the cost of significant performance degradation, as well as sometimes arbitrary changes in behavior. Alternatively, custom monitoring specific to the computer program under inspection can be written. This is understandably an inconsistent approach (e.g., due to code added to the program) and time-consuming process.
Many popular modern computer programming languages such as JAVA, PERL, C#, PYTHON, etc., are interpreted languages, meaning that they run within a well-defined runtime environment. One of the advantages of interpreted languages is that the runtime environments they run in provide support for the examination of code while the program is running, e.g., through a concept referred to as “reflection” or “introspection”. Embodiments disclosed herein use capabilities such as reflection and introspection to implement novel techniques for monitoring the live structure of running programs.
An example embodiment provides a system for observing an internal state of a software application executing in a runtime environment. The system comprises processing resources including memory and at least one processor. The processing resources are configured to perform operations comprising traversing a structure of a plurality of live data objects in the software application executing in the runtime environment, and generating a graph of shadow data objects based on the traversing, each shadow data object of the graph corresponding to a live data object of the executing software application. The operations also include providing access to the generated shadow graph via a user interface.
In certain example embodiments the at least one processor is further configured to perform the generating including forming each shadow object to include metadata associated with, and a pointer to, a respective corresponding live data object.
The metadata may include aspects of naming of the corresponding live data object and/or identification of aspects of packaging of the corresponding live data object.
Each shadow data object in the graph may include a marking identifying whether the shadow object is exposable to the user interface. The providing access may include providing access to attributes of only shadow data objects marked as being exposable to the user interface.
Certain example embodiments include performing the traversing by operations including accessing attributes of a live data object of the plurality of live data objects, and determining, based on the accessed attributes, whether all connections to child live data objects of the live data object are traversable. The operations may also include, based on the determining (a) if all connections are traversable, traversing one or more child data objects of the live data object, and (b) if not all connections are traversable, traversing only child data objects of the live data object marked by a specific one of said attributes as being traversable.
Performing the generating may include adding to the graph shadow data objects corresponding to a particular live data object only when the particular data object has been traversed.
Certain example embodiments include performing the providing access by operations including accessing a shadow data object in the graph, and determining, based on a pre-specified listing of non-exposable objects or an attribute of the shadow data object, whether the shadow data object is exposable. The operations for performing the providing access may also include displaying aspects of the shadow data object on the user interface only if the shadow data object is, based on the determining, exposable.
According to certain embodiments the processing resources may be configured to control the system to perform operations comprising updating the generated graph when a change occurs in the plurality of live data objects in real-time.
In certain example embodiments, the updating includes performing the traversing and the generating at predetermined time intervals.
According to certain example embodiments the at least one processor is further configured to control the system to perform operations comprising receiving a query via the user interface, the query being associated with a shadow data object in the graph, accessing, by following a pointer in the shadow data object, a corresponding live data object, and outputting information regarding attributes of the accessed live data object via the user interface.
The at least one processor may be further configured to control the system to perform operations comprising causing aspects of a portion of the graph to be displayed via the user interface. The query may be associated with at least some of the displayed aspects.
An example method embodiment provides for observing an internal state of a software application executing in a runtime environment using at least one processor. The example method comprises traversing a structure of a plurality of live data objects in the software application executing in the runtime environment, generating a graph of shadow data objects based on the traversing, each shadow data object of the graph corresponding to a live data object of the executing software application, and providing access to the generated shadow graph via a user interface.
The generating a graph of shadow data objects may include forming each shadow object to include metadata associated with, and a pointer to, a respective corresponding live data object.
Each shadow data object in the graph may include a marking identifying whether or not the shadow object is exposable to the user interface, and the providing access may include providing access to attributes of only shadow data objects marked as being exposable to the user interface.
The traversing a structure of a plurality of live data objects may include accessing attributes of a live data object of the plurality of live data objects, and determining, based on the accessed attributes, whether or not all connections to child live data objects of the live data object are traversable. The traversing a structure of a plurality of live data objects may also include, based on the determining (a) if all connections are traversable, traversing one or more child data objects of the live data object, and (b) if not all connections are traversable, traversing only child data objects of the live data object marked by a specific one of said attributes as being traversable.
The providing access may include accessing a shadow data object in the graph, and determining, based on a pre-specified listing of non-exposable objects or an attribute of the shadow data object, whether or not the shadow data object is exposable. The traversing a structure of a plurality of live data objects may also include displaying aspects of the shadow data object on the user interface only if the shadow data object is, based on the determining, exposable.
Another example embodiment provides a non-transitory computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor of computer, cause the computer to perform operations comprising traversing a structure of a plurality of live data objects in a software application executing in a runtime environment, generating a graph of shadow data objects based on the traversing, each shadow data object of the graph corresponding to a live data object of the executing software application, and providing access to the generated shadow graph via a user interface, in enabling observation of an internal state of the software application executing in the runtime environment.
In certain example non-transitory computer readable medium embodiments, generating a graph of shadow data objects may include forming each shadow object to include metadata associated with, and a pointer to, a respective corresponding live data object.
In certain example non-transitory computer readable medium embodiments, each shadow data object in the graph may include a marking identifying whether the shadow object is exposable to the user interface, and wherein the providing access includes providing access to attributes of only shadow data objects marked as being exposable to the user interface.
These aspects, features, and example embodiments may be used separately and/or applied in various combinations to achieve yet further embodiments of this invention.